/**
 * Created with JetBrains WebStorm.
 * User: Administrator
 * Date: 13-6-9
 * Time: 上午9:38
 * To change this template use File | Settings | File Templates.
 */

Ext.define('cloud.view.admin.AdminAdd', {
    extend: 'Ext.form.Panel',
    xtype: 'adminadd',

    requires: ['Ext.form.Panel', 'Ext.form.FieldSet', 'Ext.field.Toggle', 'Ext.field.Select', 'Ext.ux.Fileup', 'Ext.Img', 'Ext.field.Password'],
    config: {
        title: '添加管理员',
        items: [
            {
                xtype: 'toolbar',
                docked: 'bottom',
                layout: {
                    type: 'hbox',
                    pack: 'end'
                },
                items: [
                    {
                        id: 'admin_submit',
                        iconMask: true,
                        scope: this,
                        text: '提交',
                        cls: 'x-button2',
                        style: 'float:right'
                    }
                ]
            },
            {
                xtype: 'fieldset',
                title: '添加管理员',
                defaults: {
                    labelwidth: '20%',
                    xtype: 'textfield',
                    required: true,
                    clearIcon: true
                },
                items: [
                    {
                        id: 'adminadd_name',
                        name: 'name',
                        label: '用户名',
                        maxLength: 50,
                        placeHolder: '请输入用户名'
                    },
                    {
                        xtype: 'passwordfield',
                        id: 'adminadd_password',
                        name: 'password',
                        label: '密码',
                        maxLength: 50,
                        placeHolder: '请输入密码'
                    },
                    {
                        xtype: 'passwordfield',
                        id: 'adminadd_password_sure',
                        name: 'passwordforsure',
                        label: '密码',
                        maxLength: 50,
                        placeHolder: '请再次输入密码'
                    },
                    {
                        xtype: 'selectfield',
                        store: 'RoleAllFind',
                        id: 'adminadd_carid',
                        label: '请选择角色',
                        displayField: 'name',
                        valueField: 'id',
                        listeners: {
                            painted: function () {
                                var store = Ext.getStore('RoleAllFind');
                                store.load({params: {caid: localStorage.getItem('caid')}});

                            }
                        }
                    }

                ]

            }
        ]
    }
});